<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="com.mongodb.client.MongoCursor,org.bson.Document,org.bson.types.ObjectId,java.util.Date" %>
<%@ page import="mongo.CourseClass" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>课程班信息更新</title>
<script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
	<%
		CourseClass CourseClass = new CourseClass();
    	ObjectId _id = new ObjectId(request.getParameter("_id"));
		Document result = CourseClass.queryOne(_id);
	  	String coursecode = result.getString("coursecode");
	  	String name = result.getString("name");
	  	String Class = result.getString("class");
	  	String teachername = result.getString("teachername");
	  	String teachercode = result.getString("teachercode");
	  	String title = result.getString("title");
	  	String number = result.getString("number");
	  	String testtype = result.getString("testtype");
	  	String beginendweek = result.getString("beginendweek");
	  	String studytime = result.getString("studytime");
	  	String allstudytime = result.getString("allstudytime");
	  	String weekstudytime = result.getString("weekstudytime");
	  	String credit = result.getString("credit");
	  	String theortytime = result.getString("theortytime");
	  	String labtime = result.getString("labtime");
	  	String year = result.getString("year");
	  	String semester = result.getString("semester");
	%>
	<jsp:include page="../navbar.html" />
	<div class="container-fluid">
		<div class="row">
			<div class="col-md-1 col-md-offset-1">
				<a href="managercourseclassServlet?method=managerlist">
					<button type="button" class="btn btn-default"><em class="fa fa-chevron-left"></em> 返回</button>
				</a>
			</div>
		</div>	
    	<div class="row">
    		<form name="courseclass" role="form" action="managercourseclassServlet" method="post"  onsubmit="return check(this);" class="form-horizontal">
				<div class="col-md-5 col-md-offset-1">
					<div class="panel">
	                	<div class="panel-body">
	                  		<h4 class="page-header mt0">课程班必填信息</h4>
	                  	    <fieldset>
				              <div class="form-group">
				                  <label class="col-md-2 control-label">课程班代码</label>
				                  <div class="col-md-9">
				                     <input class="form-control" type="text" name="coursecode" value="<%=coursecode %>" placeholder="请输入课程班代码" readonly />
				                  </div>
				               </div> 
			                </fieldset>
		               		<fieldset>
			               		<div class="form-group">
			                  		<label class="col-md-2 control-label">课程班名称</label>
		                  			<div class="col-md-9">
		                     			<input class="form-control" type="text" name="name" value="<%=name %>" placeholder="请输入课程班名称"  />
		                  			</div>
		               			</div>	
		               		</fieldset> 
		                	<fieldset>
			               		<div class="form-group">
			               			<label class="col-md-2 control-label">教学班</label>
			               			<div class="col-md-9">
		                     			<input class="form-control" type="text" name="Class" value="<%=Class %>" placeholder="请输入教学班"  />
			               			</div>
			               		</div>	
		               		</fieldset>  
		               		<fieldset>
		               			 <div class="form-group">
			                  		<label class="col-md-2 control-label">教师姓名</label>
		                  			<div class="col-md-9">
		                     			<input class="form-control" type="text" name="teachername" value="<%=teachername %>" placeholder="请输入教师姓名" readonly />
		                  			</div>
		               			</div>
		               		</fieldset> 
		               		<fieldset>
			              		<div class="form-group">
			                  		<label class="col-md-2 control-label">教师工号</label>
		                  			<div class="col-md-9">
		                     			<input class="form-control" type="text" name="teachercode" value="<%=teachercode %>"  placeholder="请输入教师姓名" readonly />
		                  			</div>
		               			</div>
		               		</fieldset>       
	               		</div>
	            	</div>
	         	</div>
	         	<div class="col-md-5">
					<div class="panel">
	                	<div class="panel-body">
	                  		<h4 class="page-header mt0">选填信息</h4>	                  	
		               		<fieldset>
			              		<div class="form-group">
			                  		<label class="col-md-2 control-label">教师职称</label>
		                  			<div class="col-md-9">
		                     			<input class="form-control" type="text" name="title" value="<%=title %>"  placeholder="请输入教师职称" />
		                  			</div>
		               			</div>
		               		</fieldset>    
		                    <fieldset>
			              		<div class="form-group">
			                  		<label class="col-md-2 control-label">人数</label>
		                  			<div class="col-md-9">
		                     			<input class="form-control" type="text" name="number" value="<%=number %>"  placeholder="请输入人数" />
		                  			</div>
		               			</div>
		               		</fieldset>    
		               		<fieldset>
		               			 <div class="form-group">
			                  		<label class="col-md-2 control-label">考核方式</label>
		                  			<div class="col-md-9">                			
		                     			<input class="form-control" type="text" name="testtype" value="<%=testtype%>" placeholder="请输入考核方式" />
		                  			</div>
		               			</div>
		               		</fieldset> 
		               	    <fieldset>
			              		<div class="form-group">
			                  		<label class="col-md-2 control-label">起止周</label>
		                  			<div class="col-md-9">
		                     			<input class="form-control" type="text" name="beginendweek" value="<%=beginendweek %>"  placeholder="请输入起止周" />
		                  			</div>
		               			</div>
		               		</fieldset>    
		               		<fieldset>
			              		<div class="form-group">
			                  		<label class="col-md-2 control-label">学时</label>
		                  			<div class="col-md-9">
		                     			<input class="form-control" type="text" name="studytime" value="<%=studytime %>"  placeholder="请输入学时" />
		                  			</div>
		               			</div>
		               		</fieldset>  
		               		<fieldset>
			              		<div class="form-group">
			                  		<label class="col-md-2 control-label">总学时</label>
		                  			<div class="col-md-9">
		                     			<input class="form-control" type="text" name="allstudytime" value="<%=allstudytime %>"  placeholder="请输入总学时" onkeyup="value=value.replace(/[^\d]/g,'')" />
		                  			</div>
		               			</div>
		               		</fieldset>
		               		<fieldset>
			              		<div class="form-group">
			                  		<label class="col-md-2 control-label">周学时</label>
		                  			<div class="col-md-9">
		                     			<input class="form-control" type="text" name="weekstudytime" value="<%=weekstudytime %>"  placeholder="请输入周学时" />
		                  			</div>
		               			</div>
		               		</fieldset>  
		               		<fieldset>
			              		<div class="form-group">
			                  		<label class="col-md-2 control-label">学分</label>
		                  			<div class="col-md-9">
		                     			<input class="form-control" type="text" name="credit" value="<%=credit %>"  placeholder="请输入学分" />
		                  			</div>
		               			</div>
		               		</fieldset>  
		               		<fieldset>
			              		<div class="form-group">
			                  		<label class="col-md-2 control-label">理论学分</label>
		                  			<div class="col-md-9">
		                     			<input class="form-control" type="text" name="theortytime" value="<%=theortytime %>"  placeholder="请输入理论学分" />
		                  			</div>
		               			</div>
		               		</fieldset>  
		               		<fieldset>
			              		<div class="form-group">
			                  		<label class="col-md-2 control-label">实验学分</label>
		                  			<div class="col-md-9">
		                     			<input class="form-control" type="text" name="labtime" value="<%=labtime %>"  placeholder="请输入实验学分" />
		                  			</div>
		               			</div>
		               		</fieldset>  		               				               				               				               				               				               		          
	               		</div>
	            	</div>
	         	</div>
	         	<div class="col-md-10 col-md-offset-1 mb20">
          			<div class="col-md-6">
          				<button type="submit" class="btn btn-primary btn-block" name="method" value="managerupdate">确定</button> 
          			</div>
          			<div class="col-md-6">
          				<button type="reset" class="btn btn-default btn-block">重置</button> 
          			</div>
          		</div>
         	</form>
       </div>
    </div>
	<script>
	$("#myModal").modal("hide");//加载页面首先隐藏模态框，指向模态框的ID
	function changePwd(_id){//a链接的参数
		$("#myModal").modal("show");//显示模态框
		document.passwordform._id.value=_id;
	}
	//表单提交前进行数据验证，数据合法则返回true表单提交
	function check(courseclass) {  
		if(studentform.coursecode.value=="") {  
	        swal("课程班代码不能为空","请重新输入","warning");  
	        return false;  
	    } 
	    else if(studentform.name.value=="") {  
	    	swal("课程班名称不能为空","请重新输入","warning");   
	        return false;  
	    }   
	    else if(studentform.Class.value=="") {  
	   	    swal("教学班不能为空","请重新输入","warning");   
	        return false;  
	    }
	    else if(studentform.teachername.value=="") {  
	   	    swal("教师姓名不能为空","请重新输入","warning");   
	        return false;  
	    }
	    return true;  
	}   
	  

</script>
</body>
</html>